package com.weilaiwd.common.web;

import com.alibaba.fastjson.JSONObject;
import com.jfinal.core.Controller;

public class BaseAction extends Controller {
	
	public void success(String msg) {
		JSONObject json = new JSONObject();
		json.put("isSuccess", true);
		json.put("msg", msg);
		renderJson(json.toString());
	}
	
	public void success(String msg, Object obj) {
		JSONObject json = new JSONObject();
		json.put("isSuccess", true);
		json.put("msg", msg);
		json.put("obj", obj);
		renderJson(json.toString());
	}
	
	public void fail(String msg) {
		JSONObject json = new JSONObject();
		json.put("isSuccess", false);
		json.put("msg", msg);
		renderJson(json.toString());
	}
	
	public String getContextPath() {
		return getRequest().getContextPath();
	}

}
